#ifndef expressionH
#define expressionH

#include <string>
#include <stdexcept>

#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>

#include "big_int.h"
#include "implementation.h"
#include "functions.h"

big_int calculator(const std::string&);

namespace
{
	namespace qi = boost::spirit::qi;
	namespace ascii = boost::spirit::ascii;
	
	using qi::rule;
	using qi::grammar;
	using ascii::space_type;

	using std::string;
	
	template <typename Iterator>
	struct expression : grammar<Iterator, big_int(), space_type>
	{
		public:
			expression();
		private:
			rule<Iterator, big_int(), space_type> start, number, sum, product, power, expr;
			rule<Iterator, string(), space_type> function;
	};
	
	expression<string::const_iterator>& get_expression();
}

#endif
